#ifndef GAMEHOME_H
#define GAMEHOME_H
#include<QDebug>
#include<fstream>
#include<iostream>
#include<QShortcut>
#include<QFormLayout>
#include<QButtonGroup>
#include<QLineEdit>
#include<QTimer>
#include<windows.h>
#include<QPushButton>
#include<QToolTip>
#include<QDockWidget>
#include<QDialog>
#include<QPushButton>
#include<QStatusBar>
#include<QToolBar>
#include<QMessageBox>
#include<QColorDialog>
#include<QFileDialog>
#include<QFontDialog>
#include<QTimer>
#include<QInputDialog>
#include<QFile>
#include<QFileDevice>
#include<QWaitCondition>
#include<Qpainter>
#include<QPaintEvent>
#include <QWidget>
#include<QList>
class gamehome : public QWidget
{
    Q_OBJECT
public:
    enum SnakeDirect{UP=0,DOWN,LEFT,RIGHT};
    explicit gamehome(QWidget *parent = nullptr);
    void paintEvent(QPaintEvent *event) override;
public:
    const int kSnakeNodeWidth=50;
    const int kSnakeNodeHeight=50;
    int kDefaultTimeout=150;  //蛇默认的移动速度
    bool isGameStart=false;
    QList<QRectF> snakeList;
    QRectF FoodRect;
    SnakeDirect moveDirect=SnakeDirect::UP; //默认的移动方向是向上
    QTimer* timer;
    void moveUp();
    void moveDown();
    void moveLeft();
    void moveRight();
    void setSpeed(int speed);
    bool checkFail();
    void createNewFood();
signals:

};

#endif // GAMEHOME_H
